package game.module.kefu.logic;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import game.HallServer;
import game.module.kefu.bean.QuestionFeedback;
import game.module.kefu.dao.QuestionFeedbackDao;

public class QuestionFeedbackDaoHelper {

	private static Logger logger = LoggerFactory.getLogger(QuestionFeedbackDaoHelper.class);

	static class SingletonHolder {
		static QuestionFeedbackDaoHelper instance = new QuestionFeedbackDaoHelper();
	}

	public static QuestionFeedbackDaoHelper getInstance() {
		return SingletonHolder.instance;
	}

	public void asyncInsertQuestionFeedback(final QuestionFeedback qfb) {
		HallServer.executorService.execute(new Runnable() {
			@Override
			public void run() {
				QuestionFeedbackDao.getInstance().insert(qfb);
			}
		});
	}

	public void asyncUpdateQuestionFeedback(final int id, final String answer) {
		HallServer.executorService.execute(new Runnable() {
			@Override
			public void run() {
				logger.debug("----根据id更新客服反馈----id = {}",id);
				QuestionFeedbackDao.getInstance().updateQuestionAnswer(id, answer);
			}
		});
	}


	public List<QuestionFeedback>  selectLimtQuestionFeedback(boolean isAnswer) {
		logger.debug("----批量查询所有客服反馈----");
		return QuestionFeedbackDao.getInstance().selectLimt(isAnswer);
	}
	
	public List<QuestionFeedback>  selectByid(int id) {
		logger.debug("----根据id查询客服反馈----");
		return QuestionFeedbackDao.getInstance().selectById(id);
	}

	
}
